/* FunChat 动画样式 */

/* 淡入淡出 */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.fade-in {
  animation: fade-in var(--transition-duration) var(--transition-timing-function);
}

.fade-out {
  animation: fade-out var(--transition-duration) var(--transition-timing-function);
}

/* 滑动 */
@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slide-out-right {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

@keyframes slide-in-left {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes slide-out-left {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@keyframes slide-in-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slide-out-up {
  from { transform: translateY(0); }
  to { transform: translateY(-100%); }
}

@keyframes slide-in-down {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes slide-out-down {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

.slide-in-right {
  animation: slide-in-right 0.3s var(--transition-timing-function);
}

.slide-out-right {
  animation: slide-out-right 0.3s var(--transition-timing-function);
}

.slide-in-left {
  animation: slide-in-left 0.3s var(--transition-timing-function);
}

.slide-out-left {
  animation: slide-out-left 0.3s var(--transition-timing-function);
}

.slide-in-up {
  animation: slide-in-up 0.3s var(--transition-timing-function);
}

.slide-out-up {
  animation: slide-out-up 0.3s var(--transition-timing-function);
}

.slide-in-down {
  animation: slide-in-down 0.3s var(--transition-timing-function);
}

.slide-out-down {
  animation: slide-out-down 0.3s var(--transition-timing-function);
}

/* 缩放 */
@keyframes scale-in {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes scale-out {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(0.5); opacity: 0; }
}

.scale-in {
  animation: scale-in 0.3s var(--transition-timing-function);
}

.scale-out {
  animation: scale-out 0.3s var(--transition-timing-function);
}

/* 旋转 */
@keyframes rotate-360 {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.rotate-360 {
  animation: rotate-360 1s linear infinite;
}

/* 脉冲 */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

/* 闪烁 */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.blink {
  animation: blink 1s linear infinite;
}

/* 抖动 */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.8s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* 弹跳 */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-20px); }
  60% { transform: translateY(-10px); }
}

.bounce {
  animation: bounce 1s ease infinite;
}

/* 打字效果 */
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--primary-color); }
}

.typing {
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--primary-color);
  animation: 
    typing 3.5s steps(40, end),
    blink-caret 0.75s step-end infinite;
}

/* 消息气泡动画 */
@keyframes message-pop-in {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.message-pop-in {
  animation: message-pop-in 0.3s var(--transition-timing-function);
  transform-origin: bottom left;
}

.message-pop-in-self {
  animation: message-pop-in 0.3s var(--transition-timing-function);
  transform-origin: bottom right;
}

/* 加载动画 */
@keyframes loading-dots {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.loading-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary-color);
  margin: 0 2px;
}

.loading-dots span:nth-child(1) {
  animation: loading-dots 1.4s infinite ease-in-out both;
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation: loading-dots 1.4s infinite ease-in-out both;
  animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
  animation: loading-dots 1.4s infinite ease-in-out both;
}

/* 波纹效果 */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: "";
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.5s, opacity 1s;
}

.ripple:active::after {
  transform: scale(0, 0);
  opacity: 0.3;
  transition: 0s;
}

/* 过渡效果 */
.transition-all {
  transition: all var(--transition-duration) var(--transition-timing-function);
}

.transition-opacity {
  transition: opacity var(--transition-duration) var(--transition-timing-function);
}

.transition-transform {
  transition: transform var(--transition-duration) var(--transition-timing-function);
}

.transition-colors {
  transition: color var(--transition-duration) var(--transition-timing-function),
              background-color var(--transition-duration) var(--transition-timing-function),
              border-color var(--transition-duration) var(--transition-timing-function);
}